/*
 * MuscCompGUIView.java
 */

package uk.ac.warwick.dcs.csufbo;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;

import com.micropraxis.gajit.Chrom;
import com.micropraxis.gajit.ChromItem;
import com.micropraxis.gajit.DupOp;
import com.micropraxis.gajit.Population;
import com.micropraxis.gajit.View;
import com.micropraxis.gajit.XOverUOp;
import com.micropraxis.util.Iterator;
import com.micropraxis.util.ListIterator;
import com.micropraxis.util.SortedList;

import java.awt.Color;
import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;

import javax.sound.midi.Instrument;
import javax.sound.midi.InvalidMidiDataException;
import javax.sound.midi.MetaEventListener;
import javax.sound.midi.MetaMessage;
import javax.sound.midi.MidiSystem;
import javax.sound.midi.MidiUnavailableException;
import javax.sound.midi.Sequence;
import javax.sound.midi.Sequencer;
import javax.sound.midi.Soundbank;
import javax.sound.midi.Synthesizer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JTable;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * The application's main frame.
 */
public class MainGUI extends FrameView
{

	public MainGUI(SingleFrameApplication app)
	{
		super(app);

		initComponents();
		
		mAna = new MidiAnalyser();

		// status bar initialization - message timeout, idle icon and busy
		// animation, etc
		ResourceMap resourceMap = getResourceMap();
		int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
		messageTimer = new Timer(messageTimeout, new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				statusMessageLabel.setText("");
			}
		});
		messageTimer.setRepeats(false);
		int busyAnimationRate = resourceMap
				.getInteger("StatusBar.busyAnimationRate");
		for (int i = 0; i < busyIcons.length; i++)
		{
			busyIcons[i] = resourceMap
					.getIcon("StatusBar.busyIcons[" + i + "]");
		}
		busyIconTimer = new Timer(busyAnimationRate, new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
				statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
			}
		});
		idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
		statusAnimationLabel.setIcon(idleIcon);
		progressBar.setVisible(false);

		// connecting action tasks to status bar via TaskMonitor
		TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
		taskMonitor
				.addPropertyChangeListener(new java.beans.PropertyChangeListener()
				{
					public void propertyChange(
							java.beans.PropertyChangeEvent evt)
					{
						String propertyName = evt.getPropertyName();
						if ("started".equals(propertyName))
						{
							if (!busyIconTimer.isRunning())
							{
								statusAnimationLabel.setIcon(busyIcons[0]);
								busyIconIndex = 0;
								busyIconTimer.start();
							}
							progressBar.setVisible(true);
							progressBar.setIndeterminate(true);
						}
						else if ("done".equals(propertyName))
						{
							busyIconTimer.stop();
							statusAnimationLabel.setIcon(idleIcon);
							progressBar.setVisible(false);
							progressBar.setValue(0);
						}
						else if ("message".equals(propertyName))
						{
							String text = (String) (evt.getNewValue());
							statusMessageLabel.setText((text == null) ? ""
									: text);
							messageTimer.restart();
						}
						else if ("progress".equals(propertyName))
						{
							int value = (Integer) (evt.getNewValue());
							progressBar.setVisible(true);
							progressBar.setIndeterminate(false);
							progressBar.setValue(value);
						}
					}
				});
	}

	@Action
	public void showAboutBox()
	{
		if (aboutBox == null)
		{
			JFrame mainFrame = Main.getApplication().getMainFrame();
			aboutBox = new MainGUIAbout(mainFrame);
			aboutBox.setLocationRelativeTo(mainFrame);
		}
		Main.getApplication().show(aboutBox);
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents()
	{

		mainPanel = new javax.swing.JPanel();
		jPnListener = new javax.swing.JPanel();
		jButViewProb = new javax.swing.JButton();
		jScrollPane1 = new javax.swing.JScrollPane();
		jLstMidFiles = new javax.swing.JList();
		jButAddMid = new javax.swing.JButton();
		jButRemMid = new javax.swing.JButton();
		jLabel1 = new javax.swing.JLabel();
		jChkRelKey = new javax.swing.JCheckBox();
		jPnParams = new javax.swing.JPanel();
		jLabel2 = new javax.swing.JLabel();
		jSpnTemp = new javax.swing.JSpinner();
		jLabel4 = new javax.swing.JLabel();
		jLabel12 = new javax.swing.JLabel();
		jTxtRoot = new javax.swing.JTextField();
		jPnGenControl = new javax.swing.JPanel();
		jTxtNumGenes = new javax.swing.JTextField();
		jLabel5 = new javax.swing.JLabel();
		jLabel6 = new javax.swing.JLabel();
		jTxtGener = new javax.swing.JTextField();
		jLabel7 = new javax.swing.JLabel();
		jTxtChrom = new javax.swing.JTextField();
		jLabel8 = new javax.swing.JLabel();
		jTxtMutRate = new javax.swing.JTextField();
		jLabel3 = new javax.swing.JLabel();
		jCmbGenOp = new javax.swing.JComboBox();
		jLabel9 = new javax.swing.JLabel();
		jTxtGenOpProb = new javax.swing.JTextField();
		jLabel10 = new javax.swing.JLabel();
		jLabel11 = new javax.swing.JLabel();
		jTxtElite = new javax.swing.JTextField();
		jTxtCull = new javax.swing.JTextField();
		jScrollPane7 = new javax.swing.JScrollPane();
		jConsole = new javax.swing.JTextArea();
		jButRun = new javax.swing.JButton();
		jButStep = new javax.swing.JButton();
		jPnGenes = new javax.swing.JPanel();
		jScrollPane2 = new javax.swing.JScrollPane();
		jNotes1 = new javax.swing.JTable();
		jPlay1 = new javax.swing.JButton();
		jSave1 = new javax.swing.JButton();
		jSave2 = new javax.swing.JButton();
		jPlay2 = new javax.swing.JButton();
		jScrollPane3 = new javax.swing.JScrollPane();
		jNotes2 = new javax.swing.JTable();
		jSave3 = new javax.swing.JButton();
		jPlay3 = new javax.swing.JButton();
		jScrollPane4 = new javax.swing.JScrollPane();
		jNotes3 = new javax.swing.JTable();
		jSave4 = new javax.swing.JButton();
		jPlay4 = new javax.swing.JButton();
		jScrollPane5 = new javax.swing.JScrollPane();
		jNotes4 = new javax.swing.JTable();
		jSave5 = new javax.swing.JButton();
		jPlay5 = new javax.swing.JButton();
		jScrollPane6 = new javax.swing.JScrollPane();
		jNotes5 = new javax.swing.JTable();
		menuBar = new javax.swing.JMenuBar();
		javax.swing.JMenu fileMenu = new javax.swing.JMenu();
		jMenuItem2 = new javax.swing.JMenuItem();
		jMenuItem1 = new javax.swing.JMenuItem();
		javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
		javax.swing.JMenu helpMenu = new javax.swing.JMenu();
		javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
		statusPanel = new javax.swing.JPanel();
		javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
		statusMessageLabel = new javax.swing.JLabel();
		statusAnimationLabel = new javax.swing.JLabel();
		progressBar = new javax.swing.JProgressBar(0,100);

		mainPanel.setName("mainPanel"); // NOI18N

		jPnListener.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPnListener.setName("jPnListener"); // NOI18N

		org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application
				.getInstance(uk.ac.warwick.dcs.csufbo.Main.class).getContext()
				.getResourceMap(MainGUI.class);
		jButViewProb.setText(resourceMap.getString("jButViewProb.text")); // NOI18N
		jButViewProb.setName("jButViewProb"); // NOI18N
		jButViewProb.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				viewProbMatrix(evt);
			}
		});

		jScrollPane1.setName("jScrollPane1"); // NOI18N

		jLstMidFiles.setName("jLstMidFiles"); // NOI18N
		listModel = new DefaultListModel();
		jLstMidFiles = new JList(listModel);
		jScrollPane1.setViewportView(jLstMidFiles);

		jButAddMid.setText(resourceMap.getString("jButAddMid.text")); // NOI18N
		jButAddMid.setName("jButAddMid"); // NOI18N
		jButAddMid.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jButAddMidMouseClicked(evt);
			}
		});

		jButRemMid.setText(resourceMap.getString("jButRemMid.text")); // NOI18N
		jButRemMid.setName("jButRemMid"); // NOI18N
		jButRemMid.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jButRemMidMouseClicked(evt);
			}
		});

		jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
		jLabel1.setName("jLabel1"); // NOI18N

		jChkRelKey.setText(resourceMap.getString("jChkRelKey.text")); // NOI18N
		jChkRelKey.setName("jChkRelKey"); // NOI18N

		javax.swing.GroupLayout jPnListenerLayout = new javax.swing.GroupLayout(
				jPnListener);
		jPnListener.setLayout(jPnListenerLayout);
		jPnListenerLayout
				.setHorizontalGroup(jPnListenerLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								javax.swing.GroupLayout.Alignment.TRAILING,
								jPnListenerLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnListenerLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jScrollPane1,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																191,
																Short.MAX_VALUE)
														.addComponent(
																jChkRelKey,
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jLabel1,
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jButAddMid,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																191,
																Short.MAX_VALUE)
														.addComponent(
																jButRemMid,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																191,
																Short.MAX_VALUE)
														.addComponent(
																jButViewProb,
																javax.swing.GroupLayout.Alignment.LEADING,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE))
										.addContainerGap()));
		jPnListenerLayout
				.setVerticalGroup(jPnListenerLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnListenerLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(jLabel1)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(
												jScrollPane1,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jButAddMid)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(jButRemMid)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
										.addComponent(jChkRelKey)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE).addComponent(
												jButViewProb).addContainerGap()));

		jPnParams.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPnParams.setName("jPnParams"); // NOI18N

		jLabel2.setFont(resourceMap.getFont("jLabel2.font")); // NOI18N
		jLabel2.setText(resourceMap.getString("jLabel2.text")); // NOI18N
		jLabel2.setName("jLabel2"); // NOI18N

		jSpnTemp.setModel(new javax.swing.SpinnerNumberModel(120, 60, 300, 1));
		jSpnTemp.setName("jSpnTemp"); // NOI18N

		jLabel4.setText(resourceMap.getString("jLabel4.text")); // NOI18N
		jLabel4.setName("jLabel4"); // NOI18N

		jLabel12.setText(resourceMap.getString("jLabel12.text")); // NOI18N
		jLabel12.setName("jLabel12"); // NOI18N

		jTxtRoot.setText(resourceMap.getString("jtxtRoot.text")); // NOI18N
		jTxtRoot.setName("jtxtRoot"); // NOI18N

		javax.swing.GroupLayout jPnParamsLayout = new javax.swing.GroupLayout(
				jPnParams);
		jPnParams.setLayout(jPnParamsLayout);
		jPnParamsLayout
				.setHorizontalGroup(jPnParamsLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnParamsLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnParamsLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(jLabel2)
														.addGroup(
																javax.swing.GroupLayout.Alignment.TRAILING,
																jPnParamsLayout
																		.createSequentialGroup()
																		.addGroup(
																				jPnParamsLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jLabel4)
																						.addComponent(
																								jLabel12))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				28,
																				Short.MAX_VALUE)
																		.addGroup(
																				jPnParamsLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.TRAILING,
																								false)
																						.addComponent(
																								jTxtRoot)
																						.addComponent(
																								jSpnTemp))))
										.addContainerGap()));
		jPnParamsLayout
				.setVerticalGroup(jPnParamsLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnParamsLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnParamsLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.TRAILING)
														.addComponent(
																jSpnTemp,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addGroup(
																jPnParamsLayout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel2)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jLabel4)))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnParamsLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																jTxtRoot,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(
																jLabel12,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																15,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap(46, Short.MAX_VALUE)));

		jPnGenControl.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPnGenControl.setName("jPnGenControl"); // NOI18N

		jTxtNumGenes.setText(resourceMap.getString("jtxtGenNum.text")); // NOI18N
		jTxtNumGenes.setName("jtxtGenNum"); // NOI18N

		jLabel5.setText(resourceMap.getString("jLabel5.text")); // NOI18N
		jLabel5.setName("jLabel5"); // NOI18N

		jLabel6.setText(resourceMap.getString("jLabel6.text")); // NOI18N
		jLabel6.setName("jLabel6"); // NOI18N

		jTxtGener.setText(resourceMap.getString("jtxtGener.text")); // NOI18N
		jTxtGener.setName("jtxtGener"); // NOI18N

		jLabel7.setText(resourceMap.getString("jLabel7.text")); // NOI18N
		jLabel7.setName("jLabel7"); // NOI18N

		jTxtChrom.setText(resourceMap.getString("jtxtChrom.text")); // NOI18N
		jTxtChrom.setName("jtxtChrom"); // NOI18N

		jLabel8.setText(resourceMap.getString("jLabel8.text")); // NOI18N
		jLabel8.setName("jLabel8"); // NOI18N

		jTxtMutRate.setText(resourceMap.getString("jtxtMutRate.text")); // NOI18N
		jTxtMutRate.setName("jtxtMutRate"); // NOI18N

		jLabel3.setText(resourceMap.getString("jLabel3.text")); // NOI18N
		jLabel3.setName("jLabel3"); // NOI18N

		jCmbGenOp.setModel(new javax.swing.DefaultComboBoxModel(new String[] {
				"Creep", "Duplicate", "Kill", "Add Random", "Shift",
				"Transpose", "Single Gene XOver", "N-Point XOver",
				"Integer XOver", "Copy" }));
		jCmbGenOp.setSelectedIndex(1);
		jCmbGenOp.setName("jCmbGenOp"); // NOI18N

		jLabel9.setText(resourceMap.getString("jLabel9.text")); // NOI18N
		jLabel9.setName("jLabel9"); // NOI18N

		jTxtGenOpProb.setText(resourceMap.getString("jtxtOpProb.text")); // NOI18N
		jTxtGenOpProb.setName("jtxtOpProb"); // NOI18N

		jLabel10.setText(resourceMap.getString("jLabel10.text")); // NOI18N
		jLabel10.setName("jLabel10"); // NOI18N

		jLabel11.setText(resourceMap.getString("jLabel11.text")); // NOI18N
		jLabel11.setName("jLabel11"); // NOI18N

		jTxtElite.setText(resourceMap.getString("jtxtElRate.text")); // NOI18N
		jTxtElite.setName("jtxtElRate"); // NOI18N

		jTxtCull.setText(resourceMap.getString("jtxtCullRate.text")); // NOI18N
		jTxtCull.setName("jtxtCullRate"); // NOI18N

		jScrollPane7.setName("jScrollPane7"); // NOI18N

		jConsole.setColumns(20);
		jConsole.setRows(5);
		jConsole.setName("jConsole"); // NOI18N
		jScrollPane7.setViewportView(jConsole);

		jButRun.setText(resourceMap.getString("jCmdRun.text")); // NOI18N
		jButRun.setName("jCmdRun"); // NOI18N
		jButRun.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jButRunMouseClicked(evt);
			}
		});

		jButStep.setText(resourceMap.getString("jCmdStep.text")); // NOI18N
		jButStep.setName("jCmdStep"); // NOI18N
		jButStep.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jButStepMouseClicked(evt);
			}
		});

		javax.swing.GroupLayout jPnGenControlLayout = new javax.swing.GroupLayout(
				jPnGenControl);
		jPnGenControl.setLayout(jPnGenControlLayout);
		jPnGenControlLayout
				.setHorizontalGroup(jPnGenControlLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnGenControlLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnGenControlLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																jPnGenControlLayout
																		.createParallelGroup(
																				javax.swing.GroupLayout.Alignment.LEADING,
																				false)
																		.addGroup(
																				jPnGenControlLayout
																						.createSequentialGroup()
																						.addComponent(
																								jLabel5)
																						.addGap(
																								18,
																								18,
																								18)
																						.addComponent(
																								jTxtGener))
																		.addGroup(
																				jPnGenControlLayout
																						.createSequentialGroup()
																						.addGroup(
																								jPnGenControlLayout
																										.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING)
																										.addComponent(
																												jLabel7)
																										.addComponent(
																												jLabel6))
																						.addPreferredGap(
																								javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																								9,
																								Short.MAX_VALUE)
																						.addGroup(
																								jPnGenControlLayout
																										.createParallelGroup(
																												javax.swing.GroupLayout.Alignment.LEADING,
																												false)
																										.addComponent(
																												jTxtChrom)
																										.addComponent(
																												jTxtNumGenes)
																										.addComponent(
																												jTxtMutRate,
																												javax.swing.GroupLayout.PREFERRED_SIZE,
																												32,
																												javax.swing.GroupLayout.PREFERRED_SIZE))))
														.addComponent(jLabel8))
										.addGap(18, 18, 18)
										.addGroup(
												jPnGenControlLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																jPnGenControlLayout
																		.createSequentialGroup()
																		.addGroup(
																				jPnGenControlLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jLabel9)
																						.addComponent(
																								jLabel10)
																						.addComponent(
																								jLabel11))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				96,
																				Short.MAX_VALUE)
																		.addGroup(
																				jPnGenControlLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING,
																								false)
																						.addComponent(
																								jTxtCull,
																								0,
																								0,
																								Short.MAX_VALUE)
																						.addComponent(
																								jTxtElite,
																								0,
																								0,
																								Short.MAX_VALUE)
																						.addComponent(
																								jTxtGenOpProb,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								30,
																								javax.swing.GroupLayout.PREFERRED_SIZE)))
														.addGroup(
																jPnGenControlLayout
																		.createSequentialGroup()
																		.addComponent(
																				jLabel3)
																		.addGap(
																				18,
																				18,
																				18)
																		.addComponent(
																				jCmbGenOp,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				122,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addGap(18, 18, 18)
										.addGroup(
												jPnGenControlLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jScrollPane7,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																260,
																Short.MAX_VALUE)
														.addGroup(
																jPnGenControlLayout
																		.createSequentialGroup()
																		.addComponent(
																				jButRun,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				122,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jButStep,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				132,
																				Short.MAX_VALUE)))
										.addContainerGap()));
		jPnGenControlLayout
				.setVerticalGroup(jPnGenControlLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnGenControlLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnGenControlLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(jLabel5)
														.addComponent(
																jTxtGener,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(jLabel3)
														.addComponent(
																jCmbGenOp,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(
																jButRun,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																20,
																javax.swing.GroupLayout.PREFERRED_SIZE)
														.addComponent(
																jButStep,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																20,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnGenControlLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addComponent(
																jScrollPane7,
																javax.swing.GroupLayout.Alignment.TRAILING,
																0, 0,
																Short.MAX_VALUE)
														.addGroup(
																jPnGenControlLayout
																		.createSequentialGroup()
																		.addGroup(
																				jPnGenControlLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								jLabel7)
																						.addComponent(
																								jTxtChrom,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								jLabel9))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				jPnGenControlLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								jLabel6)
																						.addComponent(
																								jTxtNumGenes,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								jLabel10))
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				jPnGenControlLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.BASELINE)
																						.addComponent(
																								jLabel8)
																						.addComponent(
																								jTxtMutRate,
																								javax.swing.GroupLayout.PREFERRED_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.PREFERRED_SIZE)
																						.addComponent(
																								jLabel11)))
														.addGroup(
																jPnGenControlLayout
																		.createSequentialGroup()
																		.addComponent(
																				jTxtGenOpProb,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jTxtElite,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addComponent(
																				jTxtCull,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)))
										.addContainerGap(
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));

		jPnGenes.setBorder(javax.swing.BorderFactory.createEtchedBorder());
		jPnGenes.setName("jPnGenes"); // NOI18N

		jScrollPane2
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane2
				.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		jScrollPane2.setName("jScrollPane2"); // NOI18N

		jNotes1.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 } },
				new String[] { "", "", "", "", "", "", "", "", "", "", "", "",
						"", "", "", "" })
		{
            public Class getColumnClass(int columnIndex) {
                return java.lang.Integer.class;
            }

			public boolean isCellEditable(int rowIndex, int columnIndex)
			{
				return false;
			}
		});

		try
		{
			jNotes1.setDefaultRenderer(Class.forName("java.lang.Integer"),
					new CustomTableCellRenderer());
		}
		catch (ClassNotFoundException ex)
		{

		}
		jNotes1.setName("jNotes1"); // NOI18N
		jNotes1.setRowHeight(5);
		jNotes1.setRowSelectionAllowed(false);
		jNotes1.getTableHeader().setResizingAllowed(false);
		jNotes1.getTableHeader().setReorderingAllowed(false);
		jScrollPane2.setViewportView(jNotes1);
		jNotes1.getColumnModel().getColumn(0).setResizable(false);
		jNotes1.getColumnModel().getColumn(0).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title0")); // NOI18N
		jNotes1.getColumnModel().getColumn(1).setResizable(false);
		jNotes1.getColumnModel().getColumn(1).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title1")); // NOI18N
		jNotes1.getColumnModel().getColumn(2).setResizable(false);
		jNotes1.getColumnModel().getColumn(2).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title2")); // NOI18N
		jNotes1.getColumnModel().getColumn(3).setResizable(false);
		jNotes1.getColumnModel().getColumn(3).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title3")); // NOI18N
		jNotes1.getColumnModel().getColumn(4).setResizable(false);
		jNotes1.getColumnModel().getColumn(4).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title4")); // NOI18N
		jNotes1.getColumnModel().getColumn(5).setResizable(false);
		jNotes1.getColumnModel().getColumn(5).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title5")); // NOI18N
		jNotes1.getColumnModel().getColumn(6).setResizable(false);
		jNotes1.getColumnModel().getColumn(6).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title6")); // NOI18N
		jNotes1.getColumnModel().getColumn(7).setResizable(false);
		jNotes1.getColumnModel().getColumn(7).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title7")); // NOI18N
		jNotes1.getColumnModel().getColumn(8).setResizable(false);
		jNotes1.getColumnModel().getColumn(8).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title8")); // NOI18N
		jNotes1.getColumnModel().getColumn(9).setResizable(false);
		jNotes1.getColumnModel().getColumn(9).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title9")); // NOI18N
		jNotes1.getColumnModel().getColumn(10).setResizable(false);
		jNotes1.getColumnModel().getColumn(10).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title10")); // NOI18N
		jNotes1.getColumnModel().getColumn(11).setResizable(false);
		jNotes1.getColumnModel().getColumn(11).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title11")); // NOI18N
		jNotes1.getColumnModel().getColumn(12).setResizable(false);
		jNotes1.getColumnModel().getColumn(12).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title12")); // NOI18N
		jNotes1.getColumnModel().getColumn(13).setResizable(false);
		jNotes1.getColumnModel().getColumn(13).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title13")); // NOI18N
		jNotes1.getColumnModel().getColumn(14).setResizable(false);
		jNotes1.getColumnModel().getColumn(14).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title14")); // NOI18N
		jNotes1.getColumnModel().getColumn(15).setResizable(false);
		jNotes1.getColumnModel().getColumn(15).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title15")); // NOI18N

		jPlay1.setIcon(resourceMap.getIcon("jPlay1.icon")); // NOI18N
		jPlay1.setText(resourceMap.getString("jPlay1.text")); // NOI18N
		jPlay1.setName("jPlay1"); // NOI18N
		jPlay1.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jPlay1MouseClicked(evt);
			}
		});

		jSave1.setIcon(resourceMap.getIcon("jSave1.icon")); // NOI18N
		jSave1.setText(resourceMap.getString("jSave1.text")); // NOI18N
		jSave1.setName("jSave1"); // NOI18N
		jSave1.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jSave1MouseClicked(evt);
			}
		});

		jSave2.setIcon(resourceMap.getIcon("jSave2.icon")); // NOI18N
		jSave2.setName("jSave2"); // NOI18N
		jSave2.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jSave2MouseClicked(evt);
			}
		});

		jPlay2.setIcon(resourceMap.getIcon("jPlay2.icon")); // NOI18N
		jPlay2.setName("jPlay2"); // NOI18N
		jPlay2.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jPlay2MouseClicked(evt);
			}
		});

		jScrollPane3
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane3
				.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		jScrollPane3.setName("jScrollPane3"); // NOI18N

		jNotes2.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 } },
				new String[] { "", "", "", "", "", "", "", "", "", "", "", "",
						"", "", "", "" })
		{
            public Class getColumnClass(int columnIndex) {
                return java.lang.Integer.class;
            }

			public boolean isCellEditable(int rowIndex, int columnIndex)
			{
				return false;
			}
		});
		try
		{
			jNotes2.setDefaultRenderer(Class.forName("java.lang.Integer"),
					new CustomTableCellRenderer());
		}
		catch (ClassNotFoundException ex)
		{

		}
		jNotes2.setName("jNotes2"); // NOI18N
		jNotes2.setRowHeight(5);
		jNotes2.setRowSelectionAllowed(false);
		jNotes2.getTableHeader().setResizingAllowed(false);
		jNotes2.getTableHeader().setReorderingAllowed(false);
		jScrollPane3.setViewportView(jNotes2);
		jNotes2.getColumnModel().getColumn(0).setResizable(false);
		jNotes2.getColumnModel().getColumn(0).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title0")); // NOI18N
		jNotes2.getColumnModel().getColumn(1).setResizable(false);
		jNotes2.getColumnModel().getColumn(1).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title1")); // NOI18N
		jNotes2.getColumnModel().getColumn(2).setResizable(false);
		jNotes2.getColumnModel().getColumn(2).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title2")); // NOI18N
		jNotes2.getColumnModel().getColumn(3).setResizable(false);
		jNotes2.getColumnModel().getColumn(3).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title3")); // NOI18N
		jNotes2.getColumnModel().getColumn(4).setResizable(false);
		jNotes2.getColumnModel().getColumn(4).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title4")); // NOI18N
		jNotes2.getColumnModel().getColumn(5).setResizable(false);
		jNotes2.getColumnModel().getColumn(5).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title5")); // NOI18N
		jNotes2.getColumnModel().getColumn(6).setResizable(false);
		jNotes2.getColumnModel().getColumn(6).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title6")); // NOI18N
		jNotes2.getColumnModel().getColumn(7).setResizable(false);
		jNotes2.getColumnModel().getColumn(7).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title7")); // NOI18N
		jNotes2.getColumnModel().getColumn(8).setResizable(false);
		jNotes2.getColumnModel().getColumn(8).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title8")); // NOI18N
		jNotes2.getColumnModel().getColumn(9).setResizable(false);
		jNotes2.getColumnModel().getColumn(9).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title9")); // NOI18N
		jNotes2.getColumnModel().getColumn(10).setResizable(false);
		jNotes2.getColumnModel().getColumn(10).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title10")); // NOI18N
		jNotes2.getColumnModel().getColumn(11).setResizable(false);
		jNotes2.getColumnModel().getColumn(11).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title11")); // NOI18N
		jNotes2.getColumnModel().getColumn(12).setResizable(false);
		jNotes2.getColumnModel().getColumn(12).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title12")); // NOI18N
		jNotes2.getColumnModel().getColumn(13).setResizable(false);
		jNotes2.getColumnModel().getColumn(13).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title13")); // NOI18N
		jNotes2.getColumnModel().getColumn(14).setResizable(false);
		jNotes2.getColumnModel().getColumn(14).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title14")); // NOI18N
		jNotes2.getColumnModel().getColumn(15).setResizable(false);
		jNotes2.getColumnModel().getColumn(15).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title15")); // NOI18N

		jSave3.setIcon(resourceMap.getIcon("jSave3.icon")); // NOI18N
		jSave3.setName("jSave3"); // NOI18N
		jSave3.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jSave3MouseClicked(evt);
			}
		});

		jPlay3.setIcon(resourceMap.getIcon("jPlay3.icon")); // NOI18N
		jPlay3.setName("jPlay3"); // NOI18N
		jPlay3.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jPlay3MouseClicked(evt);
			}
		});

		jScrollPane4
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane4
				.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		jScrollPane4.setName("jScrollPane4"); // NOI18N

		jNotes3.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 } },
				new String[] { "", "", "", "", "", "", "", "", "", "", "", "",
						"", "", "", "" })
		{
            public Class getColumnClass(int columnIndex) {
                return java.lang.Integer.class;
            }

			public boolean isCellEditable(int rowIndex, int columnIndex)
			{
				return false;
			}
		});
		try
		{
			jNotes3.setDefaultRenderer(Class.forName("java.lang.Integer"),
					new CustomTableCellRenderer());
		}
		catch (ClassNotFoundException ex)
		{

		}
		jNotes3.setName("jNotes3"); // NOI18N
		jNotes3.setRowHeight(5);
		jNotes3.setRowSelectionAllowed(false);
		jNotes3.getTableHeader().setResizingAllowed(false);
		jNotes3.getTableHeader().setReorderingAllowed(false);
		jScrollPane4.setViewportView(jNotes3);
		jNotes3.getColumnModel().getColumn(0).setResizable(false);
		jNotes3.getColumnModel().getColumn(0).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title0")); // NOI18N
		jNotes3.getColumnModel().getColumn(1).setResizable(false);
		jNotes3.getColumnModel().getColumn(1).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title1")); // NOI18N
		jNotes3.getColumnModel().getColumn(2).setResizable(false);
		jNotes3.getColumnModel().getColumn(2).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title2")); // NOI18N
		jNotes3.getColumnModel().getColumn(3).setResizable(false);
		jNotes3.getColumnModel().getColumn(3).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title3")); // NOI18N
		jNotes3.getColumnModel().getColumn(4).setResizable(false);
		jNotes3.getColumnModel().getColumn(4).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title4")); // NOI18N
		jNotes3.getColumnModel().getColumn(5).setResizable(false);
		jNotes3.getColumnModel().getColumn(5).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title5")); // NOI18N
		jNotes3.getColumnModel().getColumn(6).setResizable(false);
		jNotes3.getColumnModel().getColumn(6).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title6")); // NOI18N
		jNotes3.getColumnModel().getColumn(7).setResizable(false);
		jNotes3.getColumnModel().getColumn(7).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title7")); // NOI18N
		jNotes3.getColumnModel().getColumn(8).setResizable(false);
		jNotes3.getColumnModel().getColumn(8).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title8")); // NOI18N
		jNotes3.getColumnModel().getColumn(9).setResizable(false);
		jNotes3.getColumnModel().getColumn(9).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title9")); // NOI18N
		jNotes3.getColumnModel().getColumn(10).setResizable(false);
		jNotes3.getColumnModel().getColumn(10).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title10")); // NOI18N
		jNotes3.getColumnModel().getColumn(11).setResizable(false);
		jNotes3.getColumnModel().getColumn(11).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title11")); // NOI18N
		jNotes3.getColumnModel().getColumn(12).setResizable(false);
		jNotes3.getColumnModel().getColumn(12).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title12")); // NOI18N
		jNotes3.getColumnModel().getColumn(13).setResizable(false);
		jNotes3.getColumnModel().getColumn(13).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title13")); // NOI18N
		jNotes3.getColumnModel().getColumn(14).setResizable(false);
		jNotes3.getColumnModel().getColumn(14).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title14")); // NOI18N
		jNotes3.getColumnModel().getColumn(15).setResizable(false);
		jNotes3.getColumnModel().getColumn(15).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title15")); // NOI18N

		jSave4.setIcon(resourceMap.getIcon("jSave4.icon")); // NOI18N
		jSave4.setName("jSave4"); // NOI18N
		jSave4.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jSave4MouseClicked(evt);
			}
		});

		jPlay4.setIcon(resourceMap.getIcon("jPlay4.icon")); // NOI18N
		jPlay4.setName("jPlay4"); // NOI18N
		jPlay4.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jPlay4MouseClicked(evt);
			}
		});

		jScrollPane5
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane5
				.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		jScrollPane5.setName("jScrollPane5"); // NOI18N

		jNotes4.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 } },
				new String[] { "", "", "", "", "", "", "", "", "", "", "", "",
						"", "", "", "" })
		{
            public Class getColumnClass(int columnIndex) {
                return java.lang.Integer.class;
            }

			public boolean isCellEditable(int rowIndex, int columnIndex)
			{
				return false;
			}
		});
		try
		{
			jNotes4.setDefaultRenderer(Class.forName("java.lang.Integer"),
					new CustomTableCellRenderer());
		}
		catch (ClassNotFoundException ex)
		{

		}
		jNotes4.setName("jNotes4"); // NOI18N
		jNotes4.setRowHeight(5);
		jNotes4.setRowSelectionAllowed(false);
		jNotes4.getTableHeader().setResizingAllowed(false);
		jNotes4.getTableHeader().setReorderingAllowed(false);
		jScrollPane5.setViewportView(jNotes4);
		jNotes4.getColumnModel().getColumn(0).setResizable(false);
		jNotes4.getColumnModel().getColumn(0).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title0")); // NOI18N
		jNotes4.getColumnModel().getColumn(1).setResizable(false);
		jNotes4.getColumnModel().getColumn(1).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title1")); // NOI18N
		jNotes4.getColumnModel().getColumn(2).setResizable(false);
		jNotes4.getColumnModel().getColumn(2).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title2")); // NOI18N
		jNotes4.getColumnModel().getColumn(3).setResizable(false);
		jNotes4.getColumnModel().getColumn(3).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title3")); // NOI18N
		jNotes4.getColumnModel().getColumn(4).setResizable(false);
		jNotes4.getColumnModel().getColumn(4).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title4")); // NOI18N
		jNotes4.getColumnModel().getColumn(5).setResizable(false);
		jNotes4.getColumnModel().getColumn(5).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title5")); // NOI18N
		jNotes4.getColumnModel().getColumn(6).setResizable(false);
		jNotes4.getColumnModel().getColumn(6).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title6")); // NOI18N
		jNotes4.getColumnModel().getColumn(7).setResizable(false);
		jNotes4.getColumnModel().getColumn(7).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title7")); // NOI18N
		jNotes4.getColumnModel().getColumn(8).setResizable(false);
		jNotes4.getColumnModel().getColumn(8).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title8")); // NOI18N
		jNotes4.getColumnModel().getColumn(9).setResizable(false);
		jNotes4.getColumnModel().getColumn(9).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title9")); // NOI18N
		jNotes4.getColumnModel().getColumn(10).setResizable(false);
		jNotes4.getColumnModel().getColumn(10).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title10")); // NOI18N
		jNotes4.getColumnModel().getColumn(11).setResizable(false);
		jNotes4.getColumnModel().getColumn(11).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title11")); // NOI18N
		jNotes4.getColumnModel().getColumn(12).setResizable(false);
		jNotes4.getColumnModel().getColumn(12).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title12")); // NOI18N
		jNotes4.getColumnModel().getColumn(13).setResizable(false);
		jNotes4.getColumnModel().getColumn(13).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title13")); // NOI18N
		jNotes4.getColumnModel().getColumn(14).setResizable(false);
		jNotes4.getColumnModel().getColumn(14).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title14")); // NOI18N
		jNotes4.getColumnModel().getColumn(15).setResizable(false);
		jNotes4.getColumnModel().getColumn(15).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title15")); // NOI18N

		jSave5.setIcon(resourceMap.getIcon("jSave5.icon")); // NOI18N
		jSave5.setName("jSave5"); // NOI18N
		jSave5.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jSave5MouseClicked(evt);
			}
		});

		jPlay5.setIcon(resourceMap.getIcon("jPlay5.icon")); // NOI18N
		jPlay5.setName("jPlay5"); // NOI18N
		jPlay5.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jPlay5MouseClicked(evt);
			}
		});

		jScrollPane6
				.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
		jScrollPane6
				.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
		jScrollPane6.setName("jScrollPane6"); // NOI18N

		jNotes5.setModel(new javax.swing.table.DefaultTableModel(
				new Object[][] {
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 },
						{ 0, 0, 0, 0, 0, 0, 0, 0, 0,
								0, 0, 0, 0, 0, 0, 0 } },
				new String[] { "", "", "", "", "", "", "", "", "", "", "", "",
						"", "", "", "" })
		{
            public Class getColumnClass(int columnIndex) {
                return java.lang.Integer.class;
            }

			public boolean isCellEditable(int rowIndex, int columnIndex)
			{
				return false;
			}
		});
		try
		{
			jNotes5.setDefaultRenderer(Class.forName("java.lang.Integer"),
					new CustomTableCellRenderer());
		}
		catch (ClassNotFoundException ex)
		{

		}
		jNotes5.setName("jNotes5"); // NOI18N
		jNotes5.setRowHeight(5);
		jNotes5.setRowSelectionAllowed(false);
		jNotes5.getTableHeader().setResizingAllowed(false);
		jNotes5.getTableHeader().setReorderingAllowed(false);
		jScrollPane6.setViewportView(jNotes5);
		jNotes5.getColumnModel().getColumn(0).setResizable(false);
		jNotes5.getColumnModel().getColumn(0).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title0")); // NOI18N
		jNotes5.getColumnModel().getColumn(1).setResizable(false);
		jNotes5.getColumnModel().getColumn(1).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title1")); // NOI18N
		jNotes5.getColumnModel().getColumn(2).setResizable(false);
		jNotes5.getColumnModel().getColumn(2).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title2")); // NOI18N
		jNotes5.getColumnModel().getColumn(3).setResizable(false);
		jNotes5.getColumnModel().getColumn(3).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title3")); // NOI18N
		jNotes5.getColumnModel().getColumn(4).setResizable(false);
		jNotes5.getColumnModel().getColumn(4).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title4")); // NOI18N
		jNotes5.getColumnModel().getColumn(5).setResizable(false);
		jNotes5.getColumnModel().getColumn(5).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title5")); // NOI18N
		jNotes5.getColumnModel().getColumn(6).setResizable(false);
		jNotes5.getColumnModel().getColumn(6).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title6")); // NOI18N
		jNotes5.getColumnModel().getColumn(7).setResizable(false);
		jNotes5.getColumnModel().getColumn(7).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title7")); // NOI18N
		jNotes5.getColumnModel().getColumn(8).setResizable(false);
		jNotes5.getColumnModel().getColumn(8).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title8")); // NOI18N
		jNotes5.getColumnModel().getColumn(9).setResizable(false);
		jNotes5.getColumnModel().getColumn(9).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title9")); // NOI18N
		jNotes5.getColumnModel().getColumn(10).setResizable(false);
		jNotes5.getColumnModel().getColumn(10).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title10")); // NOI18N
		jNotes5.getColumnModel().getColumn(11).setResizable(false);
		jNotes5.getColumnModel().getColumn(11).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title11")); // NOI18N
		jNotes5.getColumnModel().getColumn(12).setResizable(false);
		jNotes5.getColumnModel().getColumn(12).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title12")); // NOI18N
		jNotes5.getColumnModel().getColumn(13).setResizable(false);
		jNotes5.getColumnModel().getColumn(13).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title13")); // NOI18N
		jNotes5.getColumnModel().getColumn(14).setResizable(false);
		jNotes5.getColumnModel().getColumn(14).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title14")); // NOI18N
		jNotes5.getColumnModel().getColumn(15).setResizable(false);
		jNotes5.getColumnModel().getColumn(15).setHeaderValue(
				resourceMap.getString("jNotes1.columnModel.title15")); // NOI18N

		javax.swing.GroupLayout jPnGenesLayout = new javax.swing.GroupLayout(
				jPnGenes);
		jPnGenes.setLayout(jPnGenesLayout);
		jPnGenesLayout
				.setHorizontalGroup(jPnGenesLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnGenesLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jScrollPane2,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				410,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPnGenesLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jSave1,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								47,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPlay1,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)))
														.addGroup(
																javax.swing.GroupLayout.Alignment.TRAILING,
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jScrollPane3,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				410,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPnGenesLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jSave2,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								47,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPlay2,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)))
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jScrollPane4,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				410,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPnGenesLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jSave3,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								47,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPlay3,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)))
														.addGroup(
																javax.swing.GroupLayout.Alignment.TRAILING,
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jScrollPane5,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				410,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPnGenesLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jSave4,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								47,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPlay4,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)))
														.addGroup(
																javax.swing.GroupLayout.Alignment.TRAILING,
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jScrollPane6,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				410,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
																		.addGroup(
																				jPnGenesLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(
																								jSave5,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								47,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPlay5,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE))))
										.addContainerGap()));
		jPnGenesLayout
				.setVerticalGroup(jPnGenesLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								jPnGenesLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPlay1,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				36,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				jSave1))
														.addComponent(
																jScrollPane2,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPlay2,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				36,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				jSave2))
														.addComponent(
																jScrollPane3,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPlay3,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				36,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				jSave3))
														.addComponent(
																jScrollPane4,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPlay4,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				36,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				jSave4))
														.addComponent(
																jScrollPane5,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addGroup(
												jPnGenesLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																jPnGenesLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPlay5,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				36,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE)
																		.addComponent(
																				jSave5))
														.addComponent(
																jScrollPane6,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																72,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addContainerGap(
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)));

		javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(
				mainPanel);
		mainPanel.setLayout(mainPanelLayout);
		mainPanelLayout
				.setHorizontalGroup(mainPanelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								mainPanelLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												mainPanelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(
																jPnGenControl,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																Short.MAX_VALUE)
														.addGroup(
																mainPanelLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPnGenes,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addPreferredGap(
																				javax.swing.LayoutStyle.ComponentPlacement.RELATED)
																		.addGroup(
																				mainPanelLayout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.TRAILING)
																						.addComponent(
																								jPnParams,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(
																								jPnListener,
																								javax.swing.GroupLayout.Alignment.LEADING,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE))))
										.addContainerGap()));
		mainPanelLayout
				.setVerticalGroup(mainPanelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								mainPanelLayout
										.createSequentialGroup()
										.addContainerGap()
										.addGroup(
												mainPanelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.LEADING,
																false)
														.addGroup(
																mainPanelLayout
																		.createSequentialGroup()
																		.addComponent(
																				jPnListener,
																				javax.swing.GroupLayout.PREFERRED_SIZE,
																				284,
																				javax.swing.GroupLayout.PREFERRED_SIZE)
																		.addGap(
																				5,
																				5,
																				5)
																		.addComponent(
																				jPnParams,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				javax.swing.GroupLayout.DEFAULT_SIZE,
																				Short.MAX_VALUE))
														.addComponent(
																jPnGenes,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED,
												7, Short.MAX_VALUE)
										.addComponent(
												jPnGenControl,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addContainerGap()));

		menuBar.setName("menuBar"); // NOI18N

		fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
		fileMenu.setName("fileMenu"); // NOI18N

		jMenuItem2.setText(resourceMap.getString("jMenuItem2.text")); // NOI18N
		jMenuItem2.setName("jMenuItem2"); // NOI18N
		jMenuItem2.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jMenuItem2MouseClicked(evt);
			}
		});
		fileMenu.add(jMenuItem2);

		jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
		jMenuItem1.setName("jMenuItem1"); // NOI18N
		jMenuItem1.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				jMenuItem1MouseClicked(evt);
			}
		});
		fileMenu.add(jMenuItem1);

		javax.swing.ActionMap actionMap = org.jdesktop.application.Application
				.getInstance(uk.ac.warwick.dcs.csufbo.Main.class).getContext()
				.getActionMap(MainGUI.class, this);
		exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
		exitMenuItem.setName("exitMenuItem"); // NOI18N
		exitMenuItem.addMouseListener(new java.awt.event.MouseAdapter()
		{
			public void mouseClicked(java.awt.event.MouseEvent evt)
			{
				exitMenuItemMouseClicked(evt);
			}
		});
		fileMenu.add(exitMenuItem);

		menuBar.add(fileMenu);

		helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
		helpMenu.setName("helpMenu"); // NOI18N

		aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
		aboutMenuItem.setName("aboutMenuItem"); // NOI18N
		helpMenu.add(aboutMenuItem);

		menuBar.add(helpMenu);

		statusPanel.setName("statusPanel"); // NOI18N

		statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

		statusMessageLabel.setName("statusMessageLabel"); // NOI18N

		statusAnimationLabel
				.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
		statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

		progressBar.setName("progressBar"); // NOI18N
		progressBar.setStringPainted(true);

		javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(
				statusPanel);
		statusPanel.setLayout(statusPanelLayout);
		statusPanelLayout
				.setHorizontalGroup(statusPanelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addComponent(statusPanelSeparator,
								javax.swing.GroupLayout.DEFAULT_SIZE, 732,
								Short.MAX_VALUE)
						.addGroup(
								statusPanelLayout
										.createSequentialGroup()
										.addContainerGap()
										.addComponent(statusMessageLabel)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED,
												562, Short.MAX_VALUE)
										.addComponent(
												progressBar,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED)
										.addComponent(statusAnimationLabel)
										.addContainerGap()));
		statusPanelLayout
				.setVerticalGroup(statusPanelLayout
						.createParallelGroup(
								javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								statusPanelLayout
										.createSequentialGroup()
										.addComponent(
												statusPanelSeparator,
												javax.swing.GroupLayout.PREFERRED_SIZE,
												2,
												javax.swing.GroupLayout.PREFERRED_SIZE)
										.addPreferredGap(
												javax.swing.LayoutStyle.ComponentPlacement.RELATED,
												javax.swing.GroupLayout.DEFAULT_SIZE,
												Short.MAX_VALUE)
										.addGroup(
												statusPanelLayout
														.createParallelGroup(
																javax.swing.GroupLayout.Alignment.BASELINE)
														.addComponent(
																statusMessageLabel)
														.addComponent(
																statusAnimationLabel)
														.addComponent(
																progressBar,
																javax.swing.GroupLayout.PREFERRED_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.PREFERRED_SIZE))
										.addGap(3, 3, 3)));

		setComponent(mainPanel);
		setMenuBar(menuBar);
		setStatusBar(statusPanel);
	}// </editor-fold>//GEN-END:initComponents

	private void viewProbMatrix(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_viewProbMatrix


		transprob = new MainGUITransProb(mAna.getMChain());
		transprob.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

		transprob.setVisible(true);

	}// GEN-LAST:event_viewProbMatrix

	private void jButAddMidMouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jButAddMidMouseClicked

		File[] selFiles;
		
		chooser.setMultiSelectionEnabled(true);
		int returnVal = chooser.showOpenDialog(MainGUI.this.jButAddMid);

		if (returnVal == JFileChooser.APPROVE_OPTION)
		{
			selFiles = chooser.getSelectedFiles();
			for(int i = 0; i < selFiles.length; i++)
			{
				mAna.addSequence(selFiles[i]);
				listModel.addElement(selFiles[i]);
			}
		}
		else
		{
		}

	}// GEN-LAST:event_jButAddMidMouseClicked

	private void jButRunMouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jButRunMouseClicked
		
		int NUMGENES = Integer.parseInt(jTxtNumGenes.getText());
		int GENERATIONS = Integer.parseInt(jTxtGener.getText());
		int NUMCHROMS = Integer.parseInt(jTxtChrom.getText());
		double MUTRATE = Double.parseDouble(jTxtMutRate.getText());
		double ELITERATE = Double.parseDouble(jTxtElite.getText());
		double CULLRATE = Double.parseDouble(jTxtCull.getText());
		
		topLsys = evolve(NUMCHROMS, NUMGENES, MUTRATE, GENERATIONS, ELITERATE, CULLRATE);
		
		ArrayList<Integer> returnVal;

		returnVal = topLsys[0].getOutputString(16, 50);
		tableSet(jNotes1, returnVal);
		
		returnVal = topLsys[1].getOutputString(16, 50);
		tableSet(jNotes2, returnVal);
		
		returnVal = topLsys[2].getOutputString(16, 50);
		tableSet(jNotes3, returnVal);
		
		returnVal = topLsys[3].getOutputString(16, 50);
		tableSet(jNotes4, returnVal);
		
		returnVal = topLsys[4].getOutputString(16, 50);
		tableSet(jNotes5, returnVal);
		
	}// GEN-LAST:event_jButRunMouseClicked

	private void jButStepMouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jButStepMouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jButStepMouseClicked

	private void jButRemMidMouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jButRemMidMouseClicked
		listModel.removeElementAt(jLstMidFiles.getSelectedIndex());
		
		ArrayList<String> fileNames = new ArrayList<String>(0);
		String[] randomArray = new String[listModel.size()];
		
		for(int i = 0; i < listModel.size(); i++)
		{
			fileNames.add((String)listModel.get(i));
		}
		
		mAna = new MidiAnalyser(fileNames.toArray(randomArray));
	}// GEN-LAST:event_jButRemMidMouseClicked

	private void jPlay1MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jPlay1MouseClicked
		int tempRoot = Integer.parseInt(jTxtRoot.getText());
		int tempTempo = (Integer)jSpnTemp.getValue();
		midiPlayback(topLsys[0].toSequence(tempRoot, 16, 50), tempTempo);
	}// GEN-LAST:event_jPlay1MouseClicked

	private void jSave1MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jSave1MouseClicked

	}// GEN-LAST:event_jSave1MouseClicked

	private void jPlay2MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jPlay2MouseClicked
		int tempRoot = Integer.parseInt(jTxtRoot.getText());
		int tempTempo = (Integer)jSpnTemp.getValue();
		midiPlayback(topLsys[1].toSequence(tempRoot, 16, 50), tempTempo);
	}// GEN-LAST:event_jPlay2MouseClicked

	private void jSave2MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jSave2MouseClicked

	}// GEN-LAST:event_jSave2MouseClicked

	private void jPlay3MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jPlay3MouseClicked
		int tempRoot = Integer.parseInt(jTxtRoot.getText());
		int tempTempo = (Integer)jSpnTemp.getValue();
		midiPlayback(topLsys[2].toSequence(tempRoot, 16, 50), tempTempo);
	}// GEN-LAST:event_jPlay3MouseClicked

	private void jSave3MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jSave3MouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jSave3MouseClicked

	private void jPlay4MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jPlay4MouseClicked
		int tempRoot = Integer.parseInt(jTxtRoot.getText());
		int tempTempo = (Integer)jSpnTemp.getValue();
		midiPlayback(topLsys[3].toSequence(tempRoot, 16, 50), tempTempo);
	}// GEN-LAST:event_jPlay4MouseClicked

	private void jSave4MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jSave4MouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jSave4MouseClicked

	private void jPlay5MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jPlay5MouseClicked
		int tempRoot = Integer.parseInt(jTxtRoot.getText());
		int tempTempo = (Integer)jSpnTemp.getValue();
		midiPlayback(topLsys[4].toSequence(tempRoot, 16, 50), tempTempo);
	}// GEN-LAST:event_jPlay5MouseClicked

	private void jSave5MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jSave5MouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jSave5MouseClicked

	private void jMenuItem2MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jMenuItem2MouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jMenuItem2MouseClicked

	private void jMenuItem1MouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_jMenuItem1MouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_jMenuItem1MouseClicked

	private void exitMenuItemMouseClicked(java.awt.event.MouseEvent evt)
	{// GEN-FIRST:event_exitMenuItemMouseClicked
		// TODO add your handling code here:
	}// GEN-LAST:event_exitMenuItemMouseClicked

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JButton jButAddMid;
	private javax.swing.JButton jButRemMid;
	private javax.swing.JButton jButRun;
	private javax.swing.JButton jButStep;
	private javax.swing.JButton jButViewProb;
	private javax.swing.JCheckBox jChkRelKey;
	private javax.swing.JComboBox jCmbGenOp;
	private javax.swing.JTextArea jConsole;
	private javax.swing.JLabel jLabel1;
	private javax.swing.JLabel jLabel10;
	private javax.swing.JLabel jLabel11;
	private javax.swing.JLabel jLabel12;
	private javax.swing.JLabel jLabel2;
	private javax.swing.JLabel jLabel3;
	private javax.swing.JLabel jLabel4;
	private javax.swing.JLabel jLabel5;
	private javax.swing.JLabel jLabel6;
	private javax.swing.JLabel jLabel7;
	private javax.swing.JLabel jLabel8;
	private javax.swing.JLabel jLabel9;
	private javax.swing.JList jLstMidFiles;
	private javax.swing.JMenuItem jMenuItem1;
	private javax.swing.JMenuItem jMenuItem2;
	private javax.swing.JTable jNotes1;
	private javax.swing.JTable jNotes2;
	private javax.swing.JTable jNotes3;
	private javax.swing.JTable jNotes4;
	private javax.swing.JTable jNotes5;
	private javax.swing.JButton jPlay1;
	private javax.swing.JButton jPlay2;
	private javax.swing.JButton jPlay3;
	private javax.swing.JButton jPlay4;
	private javax.swing.JButton jPlay5;
	private javax.swing.JPanel jPnGenControl;
	private javax.swing.JPanel jPnGenes;
	private javax.swing.JPanel jPnListener;
	private javax.swing.JPanel jPnParams;
	private javax.swing.JButton jSave1;
	private javax.swing.JButton jSave2;
	private javax.swing.JButton jSave3;
	private javax.swing.JButton jSave4;
	private javax.swing.JButton jSave5;
	private javax.swing.JScrollPane jScrollPane1;
	private javax.swing.JScrollPane jScrollPane2;
	private javax.swing.JScrollPane jScrollPane3;
	private javax.swing.JScrollPane jScrollPane4;
	private javax.swing.JScrollPane jScrollPane5;
	private javax.swing.JScrollPane jScrollPane6;
	private javax.swing.JScrollPane jScrollPane7;
	private javax.swing.JSpinner jSpnTemp;
	private javax.swing.JTextField jTxtChrom;
	private javax.swing.JTextField jTxtCull;
	private javax.swing.JTextField jTxtElite;
	private javax.swing.JTextField jTxtGenOpProb;
	private javax.swing.JTextField jTxtGener;
	private javax.swing.JTextField jTxtMutRate;
	private javax.swing.JTextField jTxtNumGenes;
	private javax.swing.JTextField jTxtRoot;
	private javax.swing.JPanel mainPanel;
	private javax.swing.JMenuBar menuBar;
	private javax.swing.JProgressBar progressBar;
	private javax.swing.JLabel statusAnimationLabel;
	private javax.swing.JLabel statusMessageLabel;
	private javax.swing.JPanel statusPanel;
	// End of variables declaration//GEN-END:variables

	private final Timer messageTimer;
	private final Timer busyIconTimer;
	private final Icon idleIcon;
	private final Icon[] busyIcons = new Icon[15];
	private int busyIconIndex = 0;

	private JDialog aboutBox;
	private JFrame transprob;

	JFileChooser chooser = new JFileChooser();
	DefaultListModel listModel;
	
	private LSys[] topLsys;
	MidiAnalyser mAna;
	
	Sequencer sequencer;
	Synthesizer synthesizer;
    Instrument instruments[];   
	
	private LSys[] evolve(int NUMCHROMS, int NUMGENES, double MUTRATE, int GENERATIONS, double ELITERATE, double CULLRATE)
	{
		Population people = new Population(NUMCHROMS, NUMGENES, NUMGENES,
				MUTRATE);
		View vista = new View();
		DupOp adder = new DupOp();
		ArrayList<Integer> returnString;
		LSys temp;
		double val;

		people.setEliteRate(ELITERATE);
		people.setCullRate(CULLRATE);
		people.addOp(adder, 0.1);

		for (Iterator censo = people.iterator(); censo.hasNext();)
			System.out.println(censo.next());
		
		//progressBar.setMaximum(GENERATIONS);

		for (int i = 0; i < GENERATIONS; ++i)
		{
			Iterator censo;

			if (i % 10 == 0)
			{
				System.out.println("Generation: " + i);
				censo = people.iteratorAll();
				System.out.println("Resetting fitness values");
			}
			else
				censo = people.iteratorNewOnly();

			while (censo.hasNext())
			{
				val = 0;
				ChromItem tmp = (ChromItem) censo.next();
				Chrom chrom = tmp.getChrom();
				// int geneCount = vista.size(chrom);

				temp = new LSys(chrom);
				returnString = (ArrayList<Integer>) (temp.getOutputString(16, 50)).clone();
				if (returnString.size() < 16)
				{
					tmp.setFitness(7674574);
				}
				else
				{
					for (int j = 0; j < returnString.size() - 1; j++)
					{
						val = val + mAna.getMChain()[returnString.get(j)][returnString.get(j + 1)];
					}
					val = 1 / val;

					tmp.setFitness(val);
				}
			}
			if (i < GENERATIONS - 1)
				people.newGeneration();
			
			
			
			//progressBar.setValue(i);
		}

		SortedList results = new SortedList(people);
		ListIterator iter = results.listIterator(0);
		LSys[] returnLsys = new LSys[5];

		for(int j = 0; j < 5; j++)
		{
			ChromItem item = (ChromItem) iter.next();
			Chrom chrom = item.getChrom();

			jConsole.append(j + ": Axiom: " + vista.getGene(chrom, 0) + " - Fitness: " + item.getDoubleFitness() + "\n");
			
			System.out.println(chrom.toString());

			returnLsys[j] = new LSys(chrom);
			
			//System.out.println(temp.getOutputString(16, 50).toString());
		}

		System.out.println("Finished!");
		
		return returnLsys;
	}
	
	private void tableSet(JTable table, ArrayList<Integer> returnVal)
	{
		for (int j = 0; j < table.getColumnCount(); j++)
		{
			for (int z = 0; z < table.getRowCount(); z++)
				table.setValueAt(0, z, j);
		}

		for (int i = 0; i < returnVal.size(); i++)
		{
			table.setValueAt(-5, 11 - returnVal.get(i), i);
		}
	}
	
	private void midiPlayback(Sequence toPlay, int tempo)
	{
		try
		{
			sequencer = MidiSystem.getSequencer( );
			sequencer.open( );  
			synthesizer = MidiSystem.getSynthesizer( );
			synthesizer.open( );
			sequencer.getTransmitter( ).setReceiver(synthesizer.getReceiver( ));

			// Specify the sequence to play, and the tempo to play it at
			sequencer.setSequence(toPlay);
			sequencer.setTempoInBPM(tempo);
			
            sequencer.addMetaEventListener(new MetaEventListener( ) {
                public void meta(MetaMessage m) {
                    // A message of this type is automatically sent
                    // when we reach the end of the track
                    if (m.getType( ) == 47) 
                    {
                    	synthesizer.close();
                    	sequencer.close();
                    	System.out.println("End of sequence");
                    }
                }
            });


			sequencer.start( );
		}
		catch (MidiUnavailableException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		catch (InvalidMidiDataException e)
		{
			// TODO Auto-generated catch block
			e.printStackTrace();
		}


	}
	

	public class CustomTableCellRenderer extends DefaultTableCellRenderer
	{
		public Component getTableCellRendererComponent(JTable table,
				Object value, boolean isSelected, boolean hasFocus, int row,
				int column)
		{
			Component cell = super.getTableCellRendererComponent(table, value,
					isSelected, hasFocus, row, column);
			if (value instanceof Integer)
			{
				Integer amount = (Integer) value;
				if (amount.intValue() < 0)
				{
					cell.setBackground(Color.BLUE);
					// You can also customize the Font and Foreground this way
					cell.setForeground(Color.BLUE);
					// cell.setFont();
				}
				else
				{
					cell.setBackground(Color.white);
					cell.setForeground(Color.white);
				}
			}
			return cell;
		}
	}

}
